 /**
   * Copyright 2014 Viettel Telecom. All rights reserved.
   * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   */
 package com.viettel.core.bussiness.cms; 
import java.util.List; 

import org.springframework.beans.factory.annotation.Autowired; 

import com.viettel.core.exceptions.BusinessException; 
import com.viettel.core.exceptions.DataAccessException; 
import com.viettel.core.dao.cms.GroupCategoryDAO;
import com.viettel.core.entities.cms.GroupCategory;
import com.viettel.core.entities.vo.GroupCategorySearchFilter;
import com.viettel.core.entities.vo.GroupCategorySearchVO;
import com.viettel.core.entities.vo.GroupCategoryVO;
 /**
   *  Mo ta muc dich cua lop (interface)
   *  @author: TOANTM1
   *  @version:  
   *  @since: 27/02/2014 - 10:50:59
   */
 public class GroupCategoryMgrImpl implements GroupCategoryMgr{ 
	@Autowired 
	GroupCategoryDAO groupcategoryDAO; 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public GroupCategory getGroupCategoryById(Integer id) throws BusinessException { 
		try { 
			return  groupcategoryDAO.getGroupCategoryById(id); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public GroupCategory createGroupCategory(GroupCategory groupcategory) throws BusinessException { 
		try { 
			return groupcategoryDAO.createGroupCategory(groupcategory); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void updateGroupCategory(GroupCategory groupcategory) throws BusinessException { 
		try { 
			groupcategoryDAO.updateGroupCategory(groupcategory); 
		} catch (DataAccessException e) {	 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void deleteGroupCategory(GroupCategory groupcategory) throws BusinessException { 
		try { 
			groupcategoryDAO.deleteGroupCategory(groupcategory); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<GroupCategory> getAllGroupCategory() throws BusinessException {
		try { 
			return groupcategoryDAO.getAllGroupCategory(); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<GroupCategory> getListGroupCategoryByParentId(Integer parentId)
			throws BusinessException {
		try { 
			return groupcategoryDAO.getListGroupCategoryByParentId(parentId); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<GroupCategory> getListParentGroupCategory(Integer parentId)
			throws BusinessException {
		try { 
			return groupcategoryDAO.getListParentGroupCategory(parentId); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
	
	/**
 	 * @author tuantm20
 	 * @throws DataAccessException
 	 */
	@Override
	public List<GroupCategorySearchVO> getListGroupCategoryByFilter(GroupCategorySearchFilter filter)
			throws BusinessException {
		try { 
			return groupcategoryDAO.getListGroupCategoryByFilter(filter); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<GroupCategory> getGroupCategoryNotParent()
			throws BusinessException {
		try { 
			return groupcategoryDAO.getGroupCategoryNotParent();
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	/* (non-Javadoc)
	 * @see com.viettel.core.bussiness.GroupCategoryMgr#getListGroupCategory(int)
	 */
	@Override
	public List<GroupCategoryVO> getListGroupCategory(int groupCategoryId)
			throws BusinessException {
		try { 
			return groupcategoryDAO.getListGroupCategory(groupCategoryId);
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
	/**
 	 * @author HUYNHDC
 	 * @throws DataAccessException
 	 */
	@Override
	public List<GroupCategorySearchVO> getListGroupCategoryParentByFilter(GroupCategorySearchFilter filter) throws BusinessException{
		try { 
			return groupcategoryDAO.getListGroupCategoryParentByFilter(filter);
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}
	/**
 	 * @author HUYNHDC
 	 * @throws DataAccessException
 	 */
	@Override
 	public List<GroupCategorySearchVO> getListGroupCategoryChildByFilter(GroupCategorySearchFilter filter) throws BusinessException{
 		try { 
			return groupcategoryDAO.getListGroupCategoryChildByFilter(filter);
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
 	}
 	@Override
	public List<GroupCategory> getGroupCategoryParent()
			throws BusinessException {
		try { 
			return groupcategoryDAO.getGroupCategoryParent();
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}
 	
 	/**
 	 * @author HUYNHDC
 	 * @throws DataAccessException
 	 */
 	@Override
	public boolean checkNameExist(String userName)
			throws BusinessException {
 		try { 
			return groupcategoryDAO.checkNameExist(userName);
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
 	}
} 
